<template>
	<view>
		<scroll-view scroll-y="true" class="page-content">
			<view class="album-top">
				<view class="bg" :style="'background-image:url('+album.coverImgUrl+')'">
				</view>
				<view class="bg1">
				</view>
				<view class="album-con">
					<!-- 音乐基本 -->
					<view class="flex-box">
						<view class="img-info">
							<image class="img" :src="album.coverImgUrl" mode="widthFix"></image>
							<view class="count">
								344.5
							</view>
						</view>
						<view class="info-con flex-item">
							<view class="title">
								{{album.name}}
							</view>
							<view class="avator-box flex-box">
								<image v-if="album.creator" class="avator" :src="album.creator.avatarUrl" mode="widthFix"></image>
								<text v-if="album.creator">{{album.creator.nickname}}</text>
								<view class="iconfont">
									&#xe605;
								</view>
							</view>
							<view class="desc-box flex-box">
								<view class="desc">
									{{album.description}}...
								</view>
								<view class="iconfont">
									&#xe605;
								</view>
							</view>
						</view>
					</view>
					<!-- 音乐相关 -->
					<view class="album-bot flex-box">
						<view class="flex-item">
							<view class="iconfont">
								&#xe607;
							</view>
							<view class="txt">
								{{album.commentCount}}
							</view>
						</view>
						<view class="flex-item">
							<view class="iconfont">
								&#xe639;
							</view>
							<view class="txt">
								{{album.shareCount}}
							</view>
						</view>
						<view class="flex-item">
							<view class="iconfont">
								&#xe60e;
							</view>
							<view class="txt">
								下载
							</view>
						</view>
						<view class="flex-item">
							<view class="iconfont">
								&#xe61e;
							</view>
							<view class="txt">
								多选
							</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 播放列表 -->
			<view class="album-list">
				<view class="title-bar flex-box">
					<view class="play">
						<text class="iconfont">&#xe710;</text>
						播放全部(共{{playList.length}}首歌曲)
					</view>
					<view class="collect">
						+ 收藏
					</view>
				</view>
				<!-- 音乐列表 -->
				<view class="list">
					<view class="item flex-box" v-for="(item, index) in album.tracks" :key="index" @click="toPlay(index)">
						<view class="num" :class="{on: index < 3}">
							{{index + 1}}
						</view>
						<view class="flex-item">
							<view class="flex-box con">
								<view>
									<view class="tit">
										{{item.name}}
									</view>
									<view class="count">
										{{item.score}}
									</view>
								</view>
								<view class="iconfont">
									&#xe60f;
								</view>
							</view>
							<view class="desc">
								{{item.content}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				songListId:"",
				album: {},            //音乐对象
				playList: [],         //播放列表
			
			}
		},
		onLoad(options) {
			this.songListId=options.id;
			this.getSongList(options.id);
			
		},
		methods: {
			getSongList(data){
				this.$API.songList({id:data}).then((res)=>{
					//截取详情内容   太长了
					res.data.playlist.description = res.data.playlist.description.slice(0,27);
					this.album = res.data.playlist;
					this.playList = res.data.privileges;
					
				});
			},

			
			toPlay(index){
				this.$store.commit("setPlayList",this.playList);
				uni.navigateTo({
					url:`/pages/subpages/play/play?songIndex=${index}`
				})
			}
			
			
			
		}
	}
</script>

<style lang="scss" scoped>
$bgheight: 688rpx;
$bgtop: -44px;
.bg {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 100%;
	filter: blur(35px);
	background-position: 0 0px;
	background-repeat: no-repeat;
	background-size: cover;
}
.bg1 {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 100%;
	background: rgba(0, 0, 0, 0.2);
	z-index: 2;
}
.nav-bar {
	position: fixed;
	width:100%;
	height:64px;
	/* #ifdef H5 */
	height:44px;
	/* #endif */
	z-index: 100;
	background-position: center 0;
	background-repeat: no-repeat;
	color: #fff;
	background: #fff;
	overflow: hidden;
	.nav-bar-con{
		position: absolute;
		top:20px;
		width:100%;
		height:100%;
		padding:0 30rpx;
		z-index: 20;
		color:#fff;
		.align{
			align-items: center;
			height:44px;
			font-size: 32rpx;
		}
		.right-icon{
			width:16px;
		}
	}
	.h300{
		position:relative;
		height: $bgheight;
		.bg{
			top: 20px;
		}
	}
}
.page-content {
	position: fixed;
	top: 64px;
	left: 0;
	right: 0;
	bottom: 0;
	/* #ifdef H5 */
	top:44px;  // h5 无状态栏
	bottom: 100rpx;
	/* #endif */
}
.album-top {
	position: relative;
	top: $bgtop;
	height: $bgheight;
	padding-top:44px;
	overflow: hidden;
	background: #fff;
	.bg{
		background-size: 100%;
	}
	.album-con {
		position: absolute;
		width: 100%;
		padding: 46rpx 24rpx 0 30rpx;
		z-index: 10;
	}
}
.album-bot {
	padding-top: 42rpx;
	color: #fff;
	text-align: center;
	.iconfont {
		font-size: 44rpx;
	}
}
.img-info {
	position: relative;
	width: 280rpx;
	height: 280rpx;
	margin-right: 40rpx;
	border-radius: 10rpx;
	overflow: hidden;
	&:before {
		content: ' ';
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 40rpx;
		z-index: 2;
		background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2), transparent);
	}
	.img {
		width: 280rpx;
		height: 280rpx;
	}
	.count {
		position: absolute;
		top: 0;
		right: 0;
		padding-left: 25rpx;
		line-height: 34rpx;
		color: #fff;
		font-size: 24rpx;
		z-index: 10;
		background: url()
			no-repeat;
		background-size: 25rpx 25rpx;
		transform: scale(0.8);
	}
}
.info-con {
	.title {
		margin-bottom: 14rpx;
		color: #fff;
		line-height: 46rpx;
		font-weight: 600;
	}
}
.avator-box {
	margin-bottom: 26rpx;
	align-items: center;
	color: #ccc0ba;
	font-size: 25rpx;
	.avator {
		width: 60rpx;
		height: 60rpx;
		margin-right: 12rpx;
		border-radius: 60rpx;
	}
}
.desc-box {
	align-items: center;
	line-height: 40rpx;
	color: #ccc0ba;
	font-size: 23rpx;
}
.album-list {
	position: relative;
	top:- 84px;
	background: #fff;
	border-radius: 36rpx 36rpx 0 0;
	z-index: 100;
	.title-bar{
		padding:10rpx;
		justify-content: space-between;
		.iconfont{
			margin-left: 16rpx;
			margin-right: 16rpx;
			font-size: 40rpx;
		}
		.play{
			line-height: 80rpx;
			color:#252621;
			font-weight: 600;
			font-size: 32rpx;
		}
		.collect{
			width:228rpx;
			height:80rpx;
			text-align: center;
			line-height: 80rpx;
			border-radius: 80rpx;
			color:#fff;
			background: #fb2b21;
		}
	}
	.item {
		align-items: center;
		height: 120rpx;
	}
	.con {
		padding-right: 40rpx;
		align-items: center;
		justify-content: space-between;
	}
	.num {
		width: 84rpx;
		text-align: center;
		line-height: 120rpx;
		color: #999;
		font-size: 24rpx;
		&.on {
			color: #ff3a3a;
		}
	}
	.tit {
		margin-right: 20rpx;
		color: #333;
		line-height: 48rpx;
		font-size: 32rpx;
	}
	.count {
		margin-right: 20rpx;
		color: #ccc;
		line-height: 48rpx;
		font-size: 24rpx;
		transform: scale(0.84);
	}
	.icon {
		width: 56rpx;
		height: 20rpx;
	}
	.desc {
		color: #999;
		font-size: 24rpx;
		line-height: 40rpx;
	}
}
</style>
